package adventure.commands;

import adventure.*;
import player.*;
import colour.ColourUtil;

/**
 *
 * @author Michael Hanns
 *
 */
public class Say extends AbstractCommand {

    public Say(Adventure a) {
        super(a, new String[]{"SAY", "'"});
    }

    @Override
    public String validateAndExecute(Player p, String[] args) {
        if (args.length == 1) {
            return "Say what?";
        } else {
            out.broadcastLocalToPlayer(p,
                    ColourUtil.colourise(p.getName(), ColourUtil.magenta)
                    + " says '" + Util.consolidateArguments(args) + "'");
            return "You say '" + Util.consolidateArguments(args) + "'";
        }
    }
}
